﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Dbz.HomeworkHub.Core.Entities" assembly="Dbz.HomeworkHub.Core">

  <class name="Homework" table="Homework">

    <id name="HomeworkId">
      <generator class="identity" />
    </id>

    <property name="Name" type="string" />
    <property name="Description" type="string" />
    
    <property name="CreditPoints" type="int" />
    <property name="RequiredTopicRank" type="double" />
    
    <property name="CreationDate" type="DateTime" />
    <property name="LastSubmitDate" type="DateTime" />
    <property name="SubscriptionDate" type="DateTime" />


    <many-to-one name="Topic" column="TopicId" class="Dbz.HomeworkHub.Core.Entities.Topic" cascade="none" />
    <many-to-one name="Creator" column="CreatorId" class="Dbz.HomeworkHub.Core.Entities.User" cascade="none" />
    <many-to-one name="Subscriber" column="SubscriberId" class="Dbz.HomeworkHub.Core.Entities.User" cascade="none" />

    <bag name="Solutions" table="Solution" generic="true" inverse="true" cascade="none">
      <key column="HomeworkId" />
      <one-to-many class="Dbz.HomeworkHub.Core.Entities.Solution" />
    </bag>
    
  </class>
  
</hibernate-mapping>